﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace GqqMvcWeb.Models.Database
{
    public class department
    {
        public int DepartmentID { get; set; }

        [Required(ErrorMessage = "Department name is required.")]
        [MaxLength(50)]
        public string Name { get; set; }

        [DisplayFormat(DataFormatString = "{0:c}")]
        [Required(ErrorMessage = "Budget is required.")]
        public decimal? Budget { get; set; }

        [DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
        [Required(ErrorMessage = "Start date is required.")]
        public DateTime StartDate { get; set; }

        //the Entity Framework enables cascade delete for non-nullable foreign keys and for many-to-many relationships.
        [Display(Name = "Administrator")]
        public int? InstructorID { get; set; }

        public virtual instructor Administrator { get; set; }
        public virtual ICollection<course> Courses { get; set; }
    }
}